1. Field of the Invention
The present invention relates to an access apparatus for accessing a semiconductor memory card having internal nonvolatile memory such as EEPROM (electrical erasable programmable read-only memory), a computer-readable recording medium for recording an initialization program for a semiconductor memory card, an initialization method, and a semiconductor memory card, and in particular to an improvement for raising the efficiency with which data can be rewritten in the nonvolatile memory.
2. Description of the Background Art
Semiconductor memory cards have the advantage of being small and lightweight, and are well on the way to consolidating their position as the recording medium of choice in a wide variety of technical fields. A semiconductor memory card has an internalized nonvolatile memory known as EEPROM, which is accessed by a connected device, enabling the semiconductor memory card to be used as a recording medium. Data can be directly written into blank EEPROM sectors in the same way as for magnetic or optical discs. However, when EEPROM sectors already contain data, this data has to be deleted, returning the sectors to a blank state, before new data can be written into the sectors. In the type of EEPROM known as NAND (Not And) used in many semiconductor memory cards, the operation for returning sectors to a blank state has to be performed on 32 sectors at one time (in this nonvolatile memory, a group of 32 sectors is known as an erasable block). Consequently, the semiconductor memory card contains a specialized internal control circuit for realizing memory management using erasable blocks as access units. Status control of erasable blocks, and reading and writing of data to/from erasable blocks, is managed by this control circuit.
This means that the semiconductor memory card has a unique hardware structure (physical layer) that is completely different from that used in magnetic and optical discs. However, a layer model shown in FIG. 1A is formed from physical, file system, and application layers in the same way as in a magnetic or optical disc. FIG. 1B shows a detailed layout of the physical layer. In the drawing, the physical layer includes a volume area in which a plurality of erasable blocks are arranged. Each erasable block is formed from 32 sectors and has a data length of 16 KB. The layout of the file system layer shown in FIG. 10 is what is commonly known as a FAT (file allocation table) file system. In a FAT file system, management of the volume area is performed in units known as clusters. Volume management information is arranged at the start of the volume area, and a user area for recording user data is arranged directly following the volume management information. The volume management information includes a master boot record, a partition table, a partition boot sector, a duplexed file allocation table (FAT), and a root directory entry. The duplexed FAT shows links between the plurality of clusters included in the volume area. This kind of file system layer enables data to be stored in the application layer in a hierarchical structure formed from directories and files. By installing a layer model, the access apparatus can access a semiconductor memory card with the same procedure used to access a recording medium, such as a magnetic or optical disc, without the need to pay attention to differences in the physical layer.
However, a user has many opportunities to determine the data size of the volume area when data is stored in the volume area of the file system. When the size of the volume area is changed in response to a user request, the number of clusters included in the volume area increases or decreases accordingly. If the number of clusters is increased or decreased, the FAT formed from entries corresponding to these clusters also increases or decreases, respectively, as does the size of the volume management information in which the FAT is included. If the size of the volume management information is increased or decreased, a start address of the user area following the volume management information will also be changed. The start address of the user area changes according to the size of the volume area. Consequently, the start addresses of each cluster also change according to the size of the user area.
If the start address of each cluster changes according to the size of the user area, clusters may straddle the boundaries between two erasable blocks, and the end portion of the volume management information may be arranged in the same erasable block as a cluster positioned at the start of the user area. FIG. 1D shows the layout of the volume area when the end portion of the volume management information and the cluster positioned at the start of the user area are in the same erasable block. If clusters are arranged as shown in the drawing, and a user desires to modify data stored in a particular cluster, the two erasable blocks in which the cluster is arranged have to be read and then returned to a blank state. However, nonvolatile memory is formed from a memory component that includes a floating gate buried in an insulating layer. This memory component can only be erased a few tens of thousands of times, so if the phenomenon in which two erasable blocks have to be erased to modify one cluster frequently occurs, the lifespan of the nonvolatile memory will be significantly reduced.
Generally speaking, when 32 sectors are managed as one cluster, writing data into a cluster can be completed in 32×200 μs (200 μs the time required to write each sector), provided that the write destination has already been erased. However, if the write destination has to be erased before data can be written, a 2 ms erasure period is added. If the cluster straddles the boundary between two erasable blocks, both blocks need to be erased, and erasing the write destination takes 4 ms. As a result, the time required to write data is significantly lengthened.